import { IFeidaoAiBrowserComponent } from '@dfeidao/atom-web/interfaces';
import nodejs from '@dfeidao/atom-web/msg/nodejs';
import render from '@dfeidao/atom-web/render/render';
import p001 from './p001';
import get from '@dfeidao/atom-web/local/get';

interface Par extends Event {
	page_no: number
}

export default async function a002(fd: IFeidaoAiBrowserComponent, e: Par) {
	// todo
	const desc = get(fd, 'desc');
	const n = get(fd, 'no');
	console.log(e.page_no);


	const res = await nodejs<{ dt: Array<{ equipment_kind_no: string }>, t: number }>('device-type/zj-000005/s001', {
		filter: {
			equip_type_no: n,
			//equipment_kind_no: '',
			equipment_kind_name: '',
			pn: e.page_no,
			desc
		}
	});
	const arr: String[] = [];
	res.dt.forEach((v) => {
		arr.push(v.equipment_kind_no);
	});
	//console.log(arr);
	render(fd, res.dt, p001, 'p001', 'inner');

}
